package com.studentstreet.tools.dbhelper;

public class DBTools {
	// 商家信息表
	public final static String TABLE_SELLER = "seller";
	public final static String SELLER_ID = "_id";
	public final static String SELLER_NAME = "seller_name";
	public final static String SELLER_EMAIL = "seller_email";
	public final static String SELLER_TEL = "seller_tel";
	public final static String SELLER_OWNER = "seller_owner";
	public final static String SELLER_ADDR = "seller_addr";
	public final static String SELLER_LOGO = "seller_logo";
	public final static String SELLER_REGTIME = "seller_regtime";

	public static String getSellerSQL() {
		return "CREATE TABLE IF NOT EXISTS  " + TABLE_SELLER + "(      "
				+ SELLER_ID + " int(10) primary key ,                  "
				+ SELLER_NAME + " varchar(50) not null,                "
				+ SELLER_EMAIL + " varchar(20) ,                       "
				+ SELLER_TEL + " varchar(13) ,                         "
				+ SELLER_OWNER + " varchar(20) ,                       "
				+ SELLER_ADDR + " varchar(100),                        "
				+ SELLER_LOGO + " varchar(100),                        "
				+ SELLER_REGTIME + " datetime );                       ";
	}

	// 商品表
	public final static String TABLE_GOODS = "goods";
	public final static String GOODS_ID = "_id";
	public final static String GOODS_CID = "goods_classId";
	public final static String GOODS_NAME = "goods_name";
	public final static String GOODS_SID = "goods_sellerID";
	public final static String GOODS_SALECLASS = "goods_saleClass";
	public final static String GOODS_PRICE = "goods_price";
	public final static String GOODS_DISCOUNT = "goods_discount";
	public final static String GOODS_IMG = "goods_image";
	public final static String GOODS_NUTRI = "goods_nutrition";
	public final static String GOODS_KEYWORD = "goods_keyword";
	public final static String GOODS_DESC = "goods_desc";
	public final static String GOODS_SALECOUNT = "goods_saleCount";
	public final static String GOODS_ONSALETIEM = "goods_onSaleTime";

	public static String getGoodsSQL() {
		return "CREATE TABLE IF NOT EXISTS " + TABLE_GOODS + "(          "
				+ GOODS_ID + " int(10) primary key ,                     "
				+ GOODS_CID + " int(1)  ,                                "
				+ GOODS_NAME + " varchar(50) not null,                   "
				+ GOODS_SID + " int(10) ,                           "
				+ GOODS_SALECLASS + " int(1) ,                           "
				+ GOODS_PRICE + " double(5,2) ,                          "
				+ GOODS_DISCOUNT + " double(5,2) ,                       "
				+ GOODS_IMG + "   varchar(100),                          "
				+ GOODS_NUTRI + " varchar(100) ,                         "
				+ GOODS_KEYWORD + " varchar(100),                        "
				+ GOODS_DESC + " varchar(200) ,                          "
				+ GOODS_SALECOUNT + " int(10) ,                          "
				+ GOODS_ONSALETIEM + " datetime );                       ";
	}

	// 评论表
	public final static String TABLE_COMMENT = "comment";
	public final static String COMMENT_ID = "_id";
	public final static String COMMENT_GID = "comment_goodsID";
	public final static String COMMENT_UID = "comment_userID";
	public final static String COMMENT_TITLE = "comment_title";
	public final static String COMMENT_CONTENT = "comment_content";
	public final static String COMMENT_RANK = "comment_rank";
	public final static String COMMENT_TIME = "comment_time";

	public static String getCommentSQL() {
		return "CREATE TABLE IF NOT EXISTS " + TABLE_COMMENT + "(  "
				+ COMMENT_ID + " int(10) primary key ,             "
				+ COMMENT_GID + " int(10) ,                        "
				+ COMMENT_UID + " int(10)  ,                       "
				+ COMMENT_TITLE + " varchar(50) ,                  "
				+ COMMENT_CONTENT + " text ,                       "
				+ COMMENT_RANK + " double(5,1),                    "
				+ COMMENT_TIME + " varchar(20) );                  ";
	}

	// 订单项表
	public final static String TABLE_ORDER_ITEM = "order_item";
	public final static String ORDER_ITEM_ID = "_id";
	public final static String ORDER_ITEM_SID = "item_sellerId";
	public final static String ORDER_ITEM_GID = "item_goodsId";
	public final static String ORDER_ITEM_UID = "item_userId";
	public final static String ORDER_ITEM_COUNT = "item_count";
	public final static String ORDER_ITEM_STATE = "item_state";
	public final static String ORDER_ITEM_ISPAID = "item_isPaid";
	public final static String ORDER_ITEM_NO = "item_no";
	public final static String ORDER_ITEM_ADDTIME = "item_addTime";
	public final static String ORDER_ITEM_ISCOMMENT = "item_isComment";
	public final static String ORDER_ITEM_UNAME = "item_userName";

	public static String getOrderItemSQL() {
		return "CREATE TABLE IF NOT EXISTS " + TABLE_ORDER_ITEM + "(     "
				+ ORDER_ITEM_ID + " INTEGER primary key AUTOINCREMENT ,  "
				+ ORDER_ITEM_GID + " int(10) not null,                   "
				+ ORDER_ITEM_UID + " int(10) ,                           "
				+ ORDER_ITEM_SID + " int(10) ,                           "
				+ ORDER_ITEM_COUNT + " int(10) ,                         "
				+ ORDER_ITEM_STATE + " int(1) DEFAULT '0',               "
				+ ORDER_ITEM_ISPAID + " int(1) default '0' ,             "
				+ ORDER_ITEM_NO + " varchar(20) ,                        "
				+ ORDER_ITEM_ADDTIME + " varchar(20) ,                   "
				+ ORDER_ITEM_UNAME + " varchar(50) ,                     "
				+ ORDER_ITEM_ISCOMMENT + " int(1) default '0');          ";
	}

	// 订单表
	public final static String TABLE_ORDER = "order_all";
	public final static String ORDER_ID = "_id";
	public final static String ORDER_NO = "order_no";
	public final static String ORDER_SID = "order_sellerID";
	public final static String ORDER_DETAIL = "order_detail";
	public final static String ORDER_TO_ADDR = "order_toAddr";
	public final static String ORDER_TO_TIME = "order_toTime";
	public final static String ORDER_TO_USER = "order_toUser";
	public final static String ORDER_STATE = "order_state";
	public final static String ORDER_ADD_TIME = "order_addTime";
	public final static String ORDER_UNAME = "order_userName";

	public static String getOrderSQL() {
		return "CREATE TABLE IF NOT EXISTS " + TABLE_ORDER + "(     "
				+ ORDER_ID + "  INTEGER primary key AUTOINCREMENT , "
				+ ORDER_NO + "  varchar(20) ,                       "
				+ ORDER_SID + "  int(10) ,                          "
				+ ORDER_DETAIL + "  varchar(100) ,                  "
				+ ORDER_TO_ADDR + " varchar(100) ,                  "
				+ ORDER_TO_TIME + " varchar(50) ,                   "
				+ ORDER_STATE + "  int(1) ,                         "
				+ ORDER_ADD_TIME + "  datetime ,                    "
				+ ORDER_UNAME + " varchar(50) ,                     "
				+ ORDER_TO_USER + " varchar(50) );                  ";
	}

	// 用户信息表
	public final static String TABLE_USER = "user";
	public final static String USER_ID = "_id";
	public final static String USER_NAME = "user_name";
	public final static String USER_HEAD = "user_head";
	public final static String USER_EMAIL = "user_email";
	public final static String USER_PASSWORD = "user_password";
	public final static String USER_SEX = "user_sex";
	public final static String USER_TEL = "user_tel";
	public final static String USER_ADDR = "user_addr";
	public final static String USER_ORIGIN = "user_origin";
	public final static String USER_CAMPUS = "user_campus";
	public final static String USER_REGTIME = "user_regtime";

	public static String getUserSQL() {
		return "CREATE TABLE IF NOT EXISTS " + TABLE_USER + "(          "
				+ USER_ID + "  INTEGER primary key  ,                   "
				+ USER_NAME + "  varchar(50) ,                          "
				+ USER_HEAD + "  varchar(50) ,                          "
				+ USER_EMAIL + "  varchar(50) ,                         "
				+ USER_PASSWORD + " varchar(100) ,                      "
				+ USER_SEX + "  varchar(50) ,                           "
				+ USER_TEL + "  varchar(50) ,                           "
				+ USER_ADDR + " varchar(100) ,                          "
				+ USER_ORIGIN + "  varchar(50) ,                        "
				+ USER_CAMPUS + "  varchar(30) ,                        "
				+ USER_REGTIME + " varchar(50)  );                      ";
	}

	// 我的收藏表
	public final static String TABLE_STORE = "store";
	public final static String STORE_ID = "_id";
	public final static String STORE_GID = "store_goodsId";
	public final static String STORE_SID = "store_sellerId";
	public final static String STORE_UID = "store_userId";
	public final static String STORE_GNAME = "store_goodsName";
	public final static String STORE_SNAME = "store_sellerName";
	public final static String STORE_UNAME = "store_userName";
	public final static String STORE_PRICE = "store_pirce";
	public final static String STORE_RANK = "store_rank";
	public final static String STORE_ADDTIME = "store_addTime";
	public final static String STORE_SALE_COUNT = "store_saleCount";
	public final static String STORE_GIMG = "store_goodsImg";

	public static String getStoreSQL() {
		return "CREATE TABLE IF NOT EXISTS " + TABLE_STORE + "(          "
				+ STORE_ID + "  INTEGER primary key  ,                   "
				+ STORE_GID + "  int(10) ,                               "
				+ STORE_SID + "  int(10) ,                               "
				+ STORE_UID + "  int(10) ,                               "
				+ STORE_GNAME + "  varchar(50) ,                         "
				+ STORE_GIMG + "  varchar(50) ,                          "
				+ STORE_SNAME + "  varchar(50) ,                         "
				+ STORE_UNAME + " varchar(50) ,                          "
				+ STORE_RANK + "  double(5,1) ,                          "
				+ STORE_PRICE + "  double(5,1) ,                         "
				+ STORE_SALE_COUNT + " int(10) ,                         "
				+ STORE_ADDTIME + " varchar(50)  );                      ";
	}

}
